home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
ML_VECTB.ZIP
/
UTILS
/
MKBALLS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-03-06
|
2KB
|
93 lines
{$M 32000,0,0}
{ Program which creates the ball-tables, using BALLS8.SFT image. }
{ by Maple Leaf, 1996 - No comments are necessarry }
uses dosio,alloc;
var f:file;
p:pointer;
procedure normalize(p:pointer);
var a:word;
begin
for a:=0 to 15 do
if mem[seg(p^):ofs(p^)+a]=1 then mem[seg(p^):ofs(p^)+a]:=0;
end;
Procedure WritePalette;
var fo:file;
begin
writeln('Creating palette file ...');
openforoutput(fo,'balls.pal','');
blockread(f,p^,768);
blockwrite(fo,p^,768);
close(fo);
end;
procedure WriteBall1;
var a,b:word; xx,yy:word; fo:file;
begin
write('Creating ball 1 : ');
openforoutput(fo,'redball.tab','');
xx:=16; yy:=16;
for a:=0 to 10 do begin
blockwrite(fo,xx,2); { write x dim }
blockwrite(fo,yy,2); { write y dim }
for b:=0 to 15 do begin
seek(f,768+(0+b)*320+a*16);
blockread(f,p^,16);
Normalize(p);
blockwrite(fo,p^,16);
end;
write('#');
end;
close(fo);
writeln;
end;
procedure WriteBall2;
var a,b:word; xx,yy:word; fo:file;
begin
write('Creating ball 2 : ');
openforoutput(fo,'blueball.tab','');
xx:=16; yy:=16;
for a:=0 to 10 do begin
blockwrite(fo,xx,2); { write x dim }
blockwrite(fo,yy,2); { write y dim }
for b:=0 to 15 do begin
seek(f,768+(16+b)*320+a*16);
blockread(f,p^,16);
Normalize(p);
blockwrite(fo,p^,16);
end;
write('#');
end;
close(fo);
writeln;
end;
procedure WriteBall3;
var a,b:word; xx,yy:word; fo:file;
begin
write('Creating ball 3 : ');
openforoutput(fo,'grnball.tab','');
xx:=16; yy:=16;
for a:=0 to 10 do begin
blockwrite(fo,xx,2); { write x dim }
blockwrite(fo,yy,2); { write y dim }
for b:=0 to 15 do begin
seek(f,768+(32+b)*320+a*16);
blockread(f,p^,16);
Normalize(p);
blockwrite(fo,p^,16);
end;
write('#');
end;
close(fo);
writeln;
end;
begin
p:=malloc(770);
openforinput(f,'balls8.sft','');
WritePalette;
WriteBall1;
WriteBall2;
WriteBall3;
closefile(f,'');
free(p);
Writeln('All done.');
end.